package com.lphl.pet.util;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

import com.lphl.pet.R;


public class BatteryDialogUtil {

    private static BatteryDialogUtil dialogUtil = null;
    private BatteryDialogUtil(){}
    public static BatteryDialogUtil getInstance(){
        if(dialogUtil == null){
            dialogUtil = new BatteryDialogUtil();
        }
        return dialogUtil;
    }

    public void showBatteryDialog(final Context ct){
        final Dialog dialog = new Dialog(ct, R.style.Dialog);
        dialog.setContentView(R.layout.single_button_dilog);
        dialog.getWindow().setLayout(dialog.getWindow().getWindowManager().getDefaultDisplay().getWidth(),
                dialog.getWindow().getAttributes().WRAP_CONTENT);

        // 以下设置三个TextView 的数据
        TextView tv_message = (TextView) dialog.findViewById(R.id.tv_message);
        tv_message.setText(ct.getResources().getString(R.string.first_menu_dialog_battery));

        TextView know = (TextView) dialog.findViewById(R.id.tv_i_know);
        know.setText(ct.getResources().getString(R.string.first_menu_dialog_btn_i_know));

        know.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
    }
}
